<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<script type="text/javascript">

$(document).ready(function(){
	$("#suchpassF").submit(function(event){
		
		$.ajax({
			type : "post",
			url : "${initParam.root}/suchMember.do",
			data:$(this).serialize(),
			datatype:"json",
			success:function(data){
				var str="";
				if(data.flag==false)
					{
						str="<p>해당하는 사용자가 없습니다</p>";
					}
				else if(data.flag==true)
					{
						str="<h3>패스 워드 변경</h1><form id= 'fform'  class='signin' >"+
						"<fieldset class='textbox'><label class='password'>"+
				        "<span>변경할 비밀번호를 입력하시오</span>"+
				        "<input type= 'password' id='password2' name='password'></label>"+
				        
				        "<button class='submit button' id='Btn' type='button'>변경하기</button>"+
				        "</fieldset></form>";
					
					}
				
				
				  
				
	    var loginBox = $("#resultdiv2");
	            $("#resultFormp2").html(str);
	    //Fade in the Popup
	    $(loginBox).fadeIn(300);
	    
	    //Set the center alignment padding + border see css style
	    var popMargTop = ($(loginBox).height() + 24) / 2; 
	    var popMargLeft = ($(loginBox).width() + 24) / 2; 
	    
	    $(loginBox).css({ 
	        'margin-top' : -popMargTop,
	        'margin-left' : -popMargLeft
	    });
	    
		
		
		
	}
});
	event.preventDefault();
});//submit


$("#resultFormp2").on("click","#Btn",function(){
$.ajax({
	type : "post",
	url : "${initParam.root}/memberUpdateByPassword.do",
	data:"id="+$('#id').val()+"&password="+$('#password2').val(),
	datatype:"json",
	success:function(data){
		
		if(data==false)
			{
				alert("변경 실패!!");
			}
		else if(data==true)
			{
				alert("변경되었습니다");
				$('#mask').remove(); 
				 location.href="${initParam.root }/main.do";
				 
			}
		
		
		
	}
});
});//submit


});
	



</script>


<a href="#" class="close"><img src="${initParam.root }/image/close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a>
<h1>패스 워드 찾기</h1>
  <form id= "suchpassF"  class="signin" >
        <fieldset class="textbox">
        <label class="username">
        <span>SSn</span>
        <input id="ssn" name="ssn"  type="password" placeholder="User Ssn">
        </label>
        <label class="password">
        <span>ID</span>
        <input id="id" name="id" type="text" autocomplete="off" placeholder="User ID">
        </label>
        <button class="submit button" type="submit">찾기</button>
      
        </fieldset>
        
<input type="hidden" name="method" value="password">
  </form>
  
  <div id="resultdiv2" class="suchresult-popup">
  <a href="#" class="close"><img src="${initParam.root }/image/close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a>
  <h1>검색 결과</h1>
  <form id= "resultForm"  class="signin" >
        <fieldset class="textbox">
         <div id="resultFormp2"></div>
        </fieldset>
        
<input type="hidden" name="method" value="password">
  </form>
  </div>
